import { Component } from "react";
import ProTable from "@/components/pro-table";
import request from "@/utils/request";

export default class RoleNew extends Component {
  columns = [
    { title: "Id", dataIndex: "id" },
    { title: "名称", dataIndex: "name" },
    { title: "标识", dataIndex: "label" },
    { title: "创建时间", dataIndex: "createTime", search: false },
  ];

  render() {
    return (
      <ProTable
        columns={this.columns}
        request={async (params) => {
          console.log("params", params);

          const resp = await request<{
            list: Role.Item[];
            pagination: Common.Pagination;
          }>({
            url: "/admin/base/sys/role/page",
            method: "POST",
            data: {
              page: params.current, // 页码
              size: params.pageSize, // 每页显示条数
            },
          });

          return {
            data: resp.list,
          };
        }}
      />
    );
  }
}
